﻿using System;
using System.IO;

namespace Hack.IO
{
    public class FileSystemWatcherExtend : FileSystemWatcher
    {
        internal static string CreateFilters(params string[] filters)
        {
            string finalFilter = String.Empty;
            if (filters.Length > 0)
            {
                for (int filter = 0; filter < filters.Length; filter++)
                {
                    finalFilter += finalFilter[filter] + (filter != filters.Length ? "|" : "");
                }
            }
            else { finalFilter = "*.*"; }

            return finalFilter;
        }
        public FileSystemWatcherExtend(string dir, params string[] filters)
            : base(dir, CreateFilters(filters)) { }
    }
}